<?php
/**
 * @version		2.0.1 | $Id: player_table.php 210 2010-06-14 21:07:35Z mwi.nor $
 */

// no direct access
defined( '_JEXEC' ) or die();
	$cparams =& JComponentHelper::getParams('com_matchdart');
?>
<?php if ($cparams->get('show_page_title', 1)) : ?>
<div class="componentheading<?php echo $this->escape($cparams->get('pageclass_sfx')); ?>">
	<?php echo $cparams->get('page_title'); ?>
</div>
<?php endif; ?>

<div class="contentheading<?php echo $this->escape($cparams->get('pageclass_sfx')); ?>">
<?php echo $this->event->EventName.' - '.$this->season->SeasonName ?>
</div>

<?php if ( $cparams->get( 'md_show_eventlogo' )) : ?> 
	<div align="center">
		<?php echo '<img src="'.$this->event->EventLogo.'" alt="MD_EVENT_LOGO">' ?>
	</div>
<?php endif; ?>

<table class="contentpane<?php echo $cparams->get('pageclass_sfx'); ?>">
	<tr class="sectiontableheader<?php echo $this->escape($cparams->get('pageclass_sfx')); ?>">
    	<td align="center"><?php echo JText::_( 'MD_TABLE_POSITION' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_PLAYERNAME' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_MATCHES' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_WIN' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_DRAW' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_LOSE' ); ?></td>
    	<?php if ($event->EventUseSets == 1) : ?>
	    	<td align="center"><?php echo JText::_( 'MD_TABLE_SETSWIN' ); ?></td>
    		<td align="center"><?php echo JText::_( 'MD_TABLE_SETSLOSE' ); ?></td>
    		<td align="center"><?php echo JText::_( 'MD_TABLE_SETSDIFF' ); ?></td>
    	<?php endif; ?>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_LEGSWIN' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_LEGSLOSE' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_LEGSDIFF' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_LWAT' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_100' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_140' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_180' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_HC' ); ?></td>
    	<td align="center"><?php echo JText::_( 'MD_TABLE_POINTS' ); ?></td>
	</tr>
<?php
    $items =& $this->items;
    $drawline = explode( ",", $this->event->EventLine );
    $pos = 1;
    $odd = 0; 

    foreach($items as $item) : ?>
		<tr class="sectiontableentry<?php echo $odd+1 . $this->escape($cparams->get('pageclass_sfx')); ?>">
	    	<td align="right"><?php echo $pos; ?></td>
	    	<td <?php echo ($this->userid == $item->PlayerUID ? 'style="color:'.$cparams->get('md_myplayercolor').'"' : ''); ?>>
	    		<?php echo $item->PlayerName; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotalMatches; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotalWins; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotalDraws; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotalLoses; ?></td>
	    	<?php if ($event->EventUseSets == 1) : ?>
		    	<td align="right"><?php echo $item->PlayerTotalSetsWin; ?></td>
	    		<td align="right"><?php echo $item->PlayerTotalSetsLose; ?></td>
	    		<td align="right"><?php echo $item->PlayerTotalSetsDiff; ?></td>
	    	<?php endif; ?>
	    	<td align="right"><?php echo $item->PlayerTotalLegsWin; ?></td>
    		<td align="right"><?php echo $item->PlayerTotalLegsLose; ?></td>
    		<td align="right"><?php echo $item->PlayerTotalLegsDiff; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotalLWATWin; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotal100; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotal140; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotal180; ?></td>
	    	<td align="right"><?php echo $item->PlayerTotalHighfinish; ?></td>
	    	<td align="right" class="highlight<?php echo $this->escape($cparams->get('pageclass_sfx')); ?>"><?php echo $item->PlayerTotalPoints; ?></td>
    	</tr>
		<?php if (in_array($pos, $drawline)) : ?>
			<tr class="sectiontableentry1<?php echo $this->escape($cparams->get('pageclass_sfx')); ?>">
				<td height="5" colspan="18" align="center" valign="middle">
					<img src="components/com_matchdart/images/line.gif" width="98%" height="5" alt="MD_LINE">
				</td>
			</tr>
		<?php endif; ?>
    	
	<?php 
	$odd = 1 - $odd;
	$pos++;
	endforeach; ?>
	<tfoot>
		<tr class="sectiontablefooter<?php echo $this->escape($cparams->get('pageclass_sfx')); ?>">
			<td colspan="18" class="createdate"><?php echo $this->lastupdate; ?></td>
		</tr>
		<tr>
			<td colspan="18" class="small"><?php echo $this->event->EventTableLegend; ?></td>
		</tr>
	</tfoot>
</table>

